<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
    <meta HTTP-EQUIV="pragma" CONTENT="no-cache">
    <meta HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate,no-store">
    <meta HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">
    <meta HTTP-EQUIV="expires" CONTENT="0">
    <meta name = "format-detection" content = "telephone=no">
    <title>购物车</title>
    <link rel="stylesheet" href="__PUBLIC__/Home/css/cart.css?v=20170306002">
    <include file="Public/common_js"/>
</head>

<if condition="$no_goods eq 1">

<body style="background:white;">
<!-- 购物车为空的时候显示 -->
<div class="warp" >
    <div class="address">
        <div class="address-list">
<if condition="$total.mobile  neq '' ">
    <!-- 有地址 -->

    <a class="address-item" href="{:url('home/Address/index')}" style="color:#232726;">
        <h3>收货人：<span>{$total.name}</span><span>{$total.mobile}</span></h3>
        <h4>收货地址:{$total.area}{$total.addr}</h4>
    </a>
    <else />
    <!-- 无地址 -->
    <a class="address-none"  href="{:url('home/Address/index')}" style="color:#232726;">
        <h3>暂无收货地址</h3>
        <h4 class="tips">为方便您更快收货，请填写收货地址额！</h4>
    </a>

</if>
        </div>
    </div>
</div>
<div class="empty-box">
    <img src="__PUBLIC__/Home/images/iconEmpty.png" alt="">
    <p>购物车里什么也没有来挑几件好货吧！</p>
    <p>
        <a href="{:url('/Home/store/index')}" class="btn btn-hollow">去首页看看</a>
    </p>
</div>
<!-- 网站主菜单 -->
<include file="Public/menu"/>
<script type="text/javascript">
    require(['cart']);
</script>
</body>

<else/>



<body>
<div class="warp" style="padding-bottom:3rem;">
    <!-- 配送地址 -->
    <div class="address">
        <div class="address-list">

            <if condition="$total.mobile  neq '' ">
            <!-- 有地址 -->

                <a class="address-item" href="{:url('home/Address/index')}" style="color:#232726;">
                    <h3>收货人：<span>{$total.name}</span><span>{$total.mobile}</span></h3>
                    <h4>收货地址:{$total.area}{$total.addr}</h4>
                </a>
             <else />
                <!-- 无地址 -->
                <a class="address-none"  href="{:url('home/Address/index')}" style="color:#232726;">
                    <h3>暂无收货地址</h3>
                    <h4 class="tips">为方便您更快收货，请填写收货地址额！</h4>
                </a>

            </if>
        </div>
    </div>
    <!-- 购物车内容 -->
    <div class="cart-content">
        <!-- 店铺分割 -->
        <volist name="cart_detail" id="acart">
           <if condition="$acart['is_self'] neq 1" >

            <div class="shop-cart" data-lid="{$acart.local_id}">
            <div class=" <if condition='$acart.shop_checkd eq 1'> shop-choice active<else/> shop-choice </if>  "    data-lid="{$acart.local_id}">{$acart.local_name}</div>

                <if condition="$acart['local_id'] neq 11">
                        <div class="logistic-choice">
                            <label>配送方式：</label>
                            <span id="logStatus" class='logStatus' <if condition="$acart.shipping eq 1">  key="1">送货上门</span><else/>   key="2">我要自提</span> </if>
                           <!-- <span id="logStatus" class='logStatus' key="1">送货上门</span>-->
                            <div class="logistic-popup">
                                <a href="javascript:void(0);" ></a>
                                <a href="javascript:void(0);" data-local={$acart['local_id']} key="1">送货上门</a>
                                <a href="javascript:void(0);" data-local={$acart['local_id']} class="active" key="2">我要自提</a>
                            </div>
                        </div>
                  <else/>
                        <div class="logistic-choice">
                            <label>配送方式：</label>
                             <span>送货上门</span>
                        </div>
                </if>

            <div class="shop-cart-list" style="position:relative;z-index:1;">
                <!-- 单个商品 -->
                <volist name="acart.products" id="product"  >
                    <if condition="$product['type'] eq 0 || $product['type'] eq 2 ">
                        <div <if condition="$product.active eq 0 ">class="single-outrange yc-data-item"<else/>class="single-item dataItem yc-data-item" </if> data-cid ='{$product.id}' data-pid ='{$product.product_id}'  data-lid ='{$product.local_id}'>
                            <div class="swipe-item">
                                <div class="choice-btn <if condition="$product.ischeck eq 1 && $product.active neq 0" >active</if>" value = "{$product.local_id},{$product.product_id}"></div>

                                <a href="{:url('goods/detail',['id'=>$product['store_pid'], 'local_id' => $storeData['local_id']])}" class="img <?php if($product['type']==2){  echo $product['initnum'] <=0 ? 'img sold_out' : '';}else{  echo ($product['store']-$product['freez']) <=0 ? 'img sold_out' : '';} ?>"><img class="img-lazyload" src="/Public/Home/images/blank.png" data-original="{$product.goods_id|getThumb=###}"></a>


                                <div class="goods-text">
                                    <a href="{:url('goods/detail',['id'=>$product['store_pid'], 'local_id' => $storeData['local_id']])}" class="name text-hide">{$product.name}</a>
                                    <p class="norms">{$product.spec_info}</p>
                                    <p class="notice" >该商品不在配送区域</p>
                                    <p class="price" id="goods_value" value="{$product.final_price|number_format=###, 2, '.', ''}">¥{$product.final_price|number_format=###, 2, '.', ''}</p>
                                    <p class="change-number">
                                        <a href="javascript:void(0);"   class="plus">+</a>
                                        <input type="number" value="{$product.cart_num}" id="goods_number" class='goods_number' readonly>
                                   <a href="javascript:void(0);"   class="minus">-</a>
                                    </p>
                                </div>
                            </div>
                            <div class="static-item">
                                <a href="javascript:void(0);" class="delete" data-id="{$product.id}">删除</a>
                                <a href="javascript:void(0);" class="collect" data-pid ='{$product.product_id}' data-lid ='{$product.local_id}' >收藏</a>
                            </div>
                        </div>
                    </if>


                    <if condition="$product['type'] eq 1">

                        <div class="<if condition='$product.active eq 1'>group-item dataItem yc-data-item<else/>group-outrange yc-data-item</if> " data-cid ='{$product.id}'  data-lid ='{$product.local_id}'>
                            <div class="swipe-item">
                                <div class="group-des"><span>组合套餐</span><label>{$product.name}</label></div>
                                <div class="item-box">
                                    <div class="choice-btn <if condition="$product['ischeck'] eq 1 && $product.active neq 0">active</if>"></div>
                                    <div class="item-content">

                                        <volist name="product.group_products" id="gProduct">
                                        <div class="goods-item">
                                            <a href="{:url('goods/detail',['id'=>$gProduct['store_pid'], 'local_id' => $storeData['local_id']])}" class="img <?php if($gProduct['type']==2){  echo $gProduct['initnum'] <=0 ? 'img sold_out' : '';}else{  echo ($gProduct['store']-$gProduct['freez']) <=0 ? 'img sold_out' : '';} ?>"><img class="img-lazyload" src="/Public/Home/images/blank.png" data-original="{$gProduct.goods_id|getThumb=###}"></a>
                                            <div class="goods-text">
                                                <a href="{:url('goods/detail',['id'=>$gProduct['store_pid'], 'local_id' => $storeData['local_id']])}" class="name text-hide">{$gProduct.product_name}</a>
                                                <p class="norms">{$gProduct.spec_info}</p>
                                                <p class="notice"  >该商品不在配送区域</p>
                                                <p class="price clearfix">
                                                    <span class="fl" id="group_item_value" >￥{$gProduct.price|number_format=###, 2, '.', ''}</span>
                                                    <input type="text" value="1" style="visibility:hidden;" id="hide_number">
                                                    <span class="fr" id="group_item_number">{$gProduct.num}</span>
                                                </p>
                                                <label class="hidesingle"></label>
                                            </div>
                                        </div>
                                        </volist>
                                        <div class="group-total">
                                            <p class="fl">套餐价:<label id="goods_value">￥{$product.final_price|number_format=###, 2, '.', ''}</label></p>

                                            <p class="change-number">
                                                <a href="javascript:void(0);" class="plus">+</a>
                                                <input type="number" value="{$product.cart_num}" id="goods_number" class="goods_number" readonly>
                                                <a href="javascript:void(0);" class="minus">-</a>
                                            </p>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="static-item">
                                <a href="javascript:void(0);" class="delete" data-id="{$product.id}">删除</a>

                            </div>
                        </div>
                    </if>
            </volist>
            </div>



            <div class="shop-settlement">
                <if condition="$acart['store_dot_name'] neq ''">
                	<span class="ship_fee">(免运费)</span>
                <else/>
                    <span class="ship_fee">(不含运费)</span>
                </if>


                <span>应付:<label class="shop-goods-price">￥{$acart.lp_fee|number_format=###, 2, '.', ''}</label></span>
            </div>

        </div>
         <elseif condition="$acart['is_self'] eq 1" />
                <?php  $isNeedId = false;   ?>
            <!--全国送-->
            <div class="shop-cart" data-lid="{$acart.local_id}">
                <div class=" <if condition='$acart.shop_checkd eq 1'> shop-choice active<else/> shop-choice </if>  "    data-lid="{$acart.local_id}">{$acart.local_name}</div>

                <if condition="$acart['is_self'] neq 1">
                    <div class="logistic-choice">
                        <label>配送方式：</label>
                        <span id="logStatus" class='logStatus' <if condition="$acart.shipping eq 1">  key="1">送货上门</span><else/>   key="2">我要自提</span> </if>
                        <!-- <span id="logStatus" class='logStatus' key="1">送货上门</span>-->
                        <div class="logistic-popup">
                            <a href="javascript:void(0);" ></a>
                            <a href="javascript:void(0);" data-local={$acart['local_id']} key="1">送货上门</a>
                            <a href="javascript:void(0);" data-local={$acart['local_id']} class="active" key="2">我要自提</a>
                        </div>
                    </div>
                    <else/>

                    <div class="logistic-choice set-nation">
                        <label>配送方式：</label>
                        <span class="logStatus">送货上门</span>
                    </div>


                </if>

                <div class="shop-cart-list" style="position:relative;z-index:1;">
                    <!-- 单个商品 -->
                    <volist name="acart.products" id="product"  >
                        <if condition="$product['type'] eq 0 || $product['type'] eq 2 ">
                            <div <if condition="$product.active_ident neq 1 ">class="single-outrange yc-data-item"<else/>class="single-item dataItem yc-data-item" </if> data-cid ='{$product.id}' data-pid ='{$product.product_id}'  data-lid ='{$product.local_id}'>
                            <div class="swipe-item">
                                <div class="choice-btn <if condition="$product.ischeck eq 1 && $product.active_ident eq 1" >active</if>" value = "{$product.local_id},{$product.product_id}"></div>

                <a href="{:url('goods/detail',['id'=>$product['store_pid'], 'local_id' => $storeData['local_id']])}" class="img <?php if($product['type']==2){  echo $product['initnum'] <=0 ? 'img sold_out' : '';}else{  echo ($product['store']-$product['freez']) <=0 ? 'img sold_out' : '';} ?>"><img class="img-lazyload" src="/Public/Home/images/blank.png" data-original="{$product.goods_id|getThumb=###}"></a>


                <div class="goods-text">
                    <a href="{:url('goods/detail',['id'=>$product['store_pid'], 'local_id' => $storeData['local_id']])}" class="name text-hide">{$product.name}</a>
                    <p class="norms text-hide">{$product.spec_info}</p>
                    <p class="notice" >该海淘商品需上传身份证！</p>
                    <?php if($product['active_ident'] != 1){ $isNeedId = true;  } ?>
                    <p class="upload-identity" data-state-id="{$product['active_ident']}">立即上传</p>
                    <p class="price" id="goods_value" <if condition="$product.active_ident neq 1">style="display:none"</if> value="{$product.final_price|number_format=###, 2, '.', ''}">¥{$product.final_price|number_format=###, 2, '.', ''}</p>
                    <p class="change-number" <if condition="$product.active_ident neq 1">style="display:none"></if>>
                        <a href="javascript:void(0);"   class="plus">+</a>
                        <input type="number" value="{$product.cart_num}" id="goods_number" class='goods_number' readonly>
                        <a href="javascript:void(0);"   class="minus">-</a>
                    </p>
                </div>
            </div>
            <div class="static-item">
                <a href="javascript:void(0);" class="delete" data-id="{$product.id}">删除</a>
                <a href="javascript:void(0);" class="collect" data-pid ='{$product.product_id}' data-lid ='{$product.local_id}' >收藏</a>
            </div>
            </div>
            </if>


            <if condition="$product['type'] eq 1">


                <div class="<if condition='$product.active_ident eq 1'>group-item dataItem yc-data-item<else/>group-outrange yc-data-item</if> " data-cid ='{$product.id}'  data-lid ='{$product.local_id}'>
                    <div class="swipe-item">
                        <div class="group-des"><span>组合套餐</span><label>{$product.name}</label></div>
                        <div class="item-box">
                            <div class="choice-btn <if condition="$product['ischeck'] eq 1 && $product.active_ident neq 0">active</if>"></div>
            <div class="item-content">

                <volist name="product.group_products" id="gProduct">
                    <div class="goods-item">
                        <a href="{:url('goods/detail',['id'=>$gProduct['store_pid'], 'local_id' => $storeData['local_id']])}" class="img <?php if($gProduct['type']==2){  echo $gProduct['initnum'] <=0 ? 'img sold_out' : '';}else{  echo ($gProduct['store']-$gProduct['freez']) <=0 ? 'img sold_out' : '';} ?>"><img class="img-lazyload" src="/Public/Home/images/blank.png" data-original="{$gProduct.goods_id|getThumb=###}"></a>
                        <div class="goods-text">
                            <a href="{:url('goods/detail',['id'=>$gProduct['store_pid'], 'local_id' => $storeData['local_id']])}" class="name text-hide">{$gProduct.product_name}</a>
                            <p class="norms text-hide">{$gProduct.spec_info}</p>
                            <p class="notice">该海淘商品需上传身份证！</p>
                            <?php if($gProduct['active_ident'] != 1){ $isNeedId = true;  } ?>
                            <p class="upload-identity"  data-state-id="{$gProduct['active_ident']}">立即上传</p>
                            <p class="price  clearfix" <if condition="$gProduct.active_ident neq 1">style="display:none"</if>>
                                <span class="fl" id="group_item_value">￥{$gProduct.price|number_format=###, 2, '.', ''}</span>
                                <input type="text" value="1" style="visibility:hidden;" id="hide_number">
                                <span class="fr" id="group_item_number">{$gProduct.num}</span>
                            </p>
                            <label class="hidesingle"></label>
                        </div>
                    </div>
                </volist>
                <div class="group-total" <if condition="$gProduct.active_ident neq 1">style="display:none"</if>>
                    <p class="fl">套餐价:<label id="goods_value"><if condition="$gProduct.active_ident neq 1">￥0.00<else/>￥{$product.final_price|number_format=###, 2, '.', ''}</if></label></p>
                    <p class="change-number">
                        <a href="javascript:void(0);" class="plus">+</a>
                        <input type="number" value="{$product.cart_num}" id="goods_number" class="goods_number" readonly>
                        <a href="javascript:void(0);" class="minus">-</a>
                    </p>
                </div>
            </div>
            </div>
            </div>
            <div class="static-item">
                <a href="javascript:void(0);" class="delete" data-id="{$product.id}">删除</a>
            </div>
            </div>
            </if>
            </volist>
            </div>

            <div class="shop-settlement">
                <if condition="$acart['store_dot_name'] neq ''">
                    <span class="ship_fee">(免运费)</span>
                    <else/>
                    <span class="ship_fee">(不含运费)</span>
                </if>
                <span>应付:<label class="shop-goods-price">￥{$acart.lp_fee|number_format=###, 2, '.', ''}</label></span>
            </div>

            </div>         
         </if>
        </volist>
        <!-- 过期商品 -->
        <div class="outTime-goods mgTop">
            <volist name="out_time" id="acart">
                        <div class="outTime-item clearfix" data-cid="{$acart['id']}">
                            <div class="out-label"></div>
                           <img class="img-lazyload" src="/Public/Home/images/blank.png" data-original="{$acart.goods_id|getThumb=###}">
                            <div class="goods-text">
                                <p class="name text-hide">{$acart.name}</p>
                                <p class="norms">{$acart.spec_info}</p>
                              <!--  <a href="javascript:void(0);" class="delete" data-id="{$acart.id}">删除</a>-->
                            </div>
                        </div>
            </volist>

            <if condition="$out_time_len neq 0">
            <div class="outTime-all">
                <a href="javascript:void(0)">清除失效商品</a>
            </div>
            </if>
        </div>
    </div>

    <if condition="$no_goods eq 0">
    <div class="clear-demo"><a href="javascript:void(0)" class="clearCart">清空购物车</a></div>
    </if>
</div>

<!-- 购物车合计 -->
<div class="cart-settment clearfix">
    <div class="left-text">
        <a href="javascript:void(0);" class="all-choice <if condition='$all_check eq 1'>active</if>">全选</a>
        <div>
            <h2>合计：<label id="cart-total-value">￥<span>{$total.goods_total_fee|number_format=###, 2, '.', ''}</span></label></h2>
        </div>
    </div>
    <a href="javascript:void(0);" class="settment-btn">提交订单</a>
</div>
<!-- 编辑状态下底部选择 -->
<div class="fixed-bot-modify" style="display:none;">
    <div class="left-text">
        <a href="javascript:void(0);" class="all-delete">全选</a>
    </div>
    <div class="right-operate">
        <a href="javascript:void(0);" class="delete-btn">删除</a>
        <a href="" class="like-btn">移入喜欢</a>
    </div>
</div>
<!-- 右侧浮动按钮 -->
<!--<div class="fixed-right-btn">
    <a href="javascript:void(0);" class="fixed-modify">编辑</a>
    <a href="javascript:void(0);" class="fixed-complete" style="display:none;">完成</a>
</div>-->
<!-- 提示弹窗 -->
<div class="alert-popup">
    <p>是否从购物车删除所选商品</p>
    <p><a href="javascript:void(0);" class="cancel">取消</a><a href="javascript:void(0);" class="confirm">确定</a></p>
</div>




<?php if($isNeedId){ ?>
<!-- 身份验证 -->
<?php $sfNeedJs = array("validate" => true, "upload" => true);?>
<include file="Public/id_validate"/>
<?php } ?>
<!-- 网站主菜单 -->
<include file="Public/menu"/>
<script type="text/javascript">
	require(['cart']);
</script>

<input type="hidden" class = 'catUrl' data-id="{:U('home/carts/cartNum')}">

<script>

    $('.outTime-all a').on('click',function () {
        var cids = new Array();
        var i=0;
        $('.outTime-item').each(function () {
            var dup=false;
           for(var j=0;j<i;j++){
               if($(this).data('cid')==cids[j]){
                   dup=true;
               }

           }
           if(!dup){
               cids[i++] = $(this).data('cid');
           }
            //console.log($(this).data('cid'));
        })
        $.ajax({
            url:"{:U('home/carts/removeOuttimeCart')}",
            type:'post',
            data:{'cids':cids},
            datatype:'json',
            success:function(data){
                if(data['no_goods']){
                    window.location.reload();
                }
                if(data['out_time'][0]){
                    alert('删除失败');
                }else{
                    $('.outTime-goods').remove();
                }
            },
            error:function(){
                alert('无法删除');
            }
        })

    })
</script>



</body>
</if>
<!-- <script>
    $(function () {
        var rnumber = Math.floor(Math.random()*1000);
        history.replaceState({mod: rnumber}, 'Title', '?mod='+rnumber);
    })
</script>-->

</html>

